﻿using System;
using Phoenix.Xna.Framework.Input;
using Phoenix.Xna.Framework.Input.Mice;

namespace Phoenix.Xna.Framework.Components.Compositors
{
    public class CursorCompositor : ImageCompositor
    {
        public CursorCompositor(string image)
            : base(image)
        {
        }

        public CursorCompositor(string id, string image)
            : base(id, image)
        {
        }

        private void OnMouseMove(object sender, InputMapEventArgs<MouseAxisMap> e)
        {
            Position = e.InputMap.CurrentPosition;
        }

        #region Compositor Members

        public override void Initialize()
        {
            // Ensure the cursor always draws last.
            DrawOrder = 999;
            //IInputManager inputService = Engine.Instance.Services.GetService<IInputManager>();

            //if (inputService != null)
            //{
            //    inputService.MapMouseAxis().ValueChanged += new EventHandler<InputMapEventArgs<MouseAxisMap>>(OnMouseMove);
            //}

            //base.Initialize();
        }

        #endregion
    }
}
